package com.audaque.springboot.foshanupload.web.webdemo.controller;

import com.audaque.springboot.foshanupload.log.anno.WebLogAnno;
import com.audaque.springboot.foshanupload.web.anno.RAnno;
import com.audaque.springboot.foshanupload.web.webdemo.model.domain.ActNodeDefMpgtModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;

/**
 * @author zgb
 * @desc ...
 * @date 2023-05-28 21:11:09
 */

@Slf4j
@RestController
@RequestMapping("linkedList")
public class LinkedListController {


    @RAnno
    @WebLogAnno
    @GetMapping("/test1")
    public void test1() throws Exception {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("1");
        String s = linkedList.get(0);
        log.debug("s:"+s); //1
        linkedList.add(0,"2");
        String s1 = linkedList.get(0);
        log.debug("s1:"+s1);  //2

    }


    @RAnno
    @WebLogAnno
    @GetMapping("/test2")
    public void test2() throws Exception {
        LinkedList<ActNodeDefMpgtModel> linkedList = new LinkedList<>();
        ActNodeDefMpgtModel actNodeDefMpgtModel1 = new ActNodeDefMpgtModel();
        actNodeDefMpgtModel1.setpNodeCode("1");
        actNodeDefMpgtModel1.setId(1);
        actNodeDefMpgtModel1.setActCode("1");
        actNodeDefMpgtModel1.setNodeCode("1");
        actNodeDefMpgtModel1.setNodeName("1");
        actNodeDefMpgtModel1.setLimitUseTime(1L);
        actNodeDefMpgtModel1.setAddReleaseUserApprovalYn(true);
        linkedList.add(actNodeDefMpgtModel1);
        ActNodeDefMpgtModel s = linkedList.get(0);
        log.debug("s:"+s); // s:ActNodeDefMpgtModel(id=1, actCode=1, nodeCode=1, nodeName=1, pNodeCode=1, limitUseTime=1, addReleaseUserApprovalYn=true)

        ActNodeDefMpgtModel actNodeDefMpgtModel2 = new ActNodeDefMpgtModel();
        actNodeDefMpgtModel2.setpNodeCode("2");
        actNodeDefMpgtModel2.setId(2);
        actNodeDefMpgtModel2.setActCode("2");
        actNodeDefMpgtModel2.setNodeCode("2");
        actNodeDefMpgtModel2.setNodeName("2");
        actNodeDefMpgtModel2.setLimitUseTime(2L);
        actNodeDefMpgtModel2.setAddReleaseUserApprovalYn(true);
        linkedList.add(0,actNodeDefMpgtModel2);
        ActNodeDefMpgtModel s1 = linkedList.get(0);
        log.debug("s1:"+s1);  //s1:ActNodeDefMpgtModel(id=2, actCode=2, nodeCode=2, nodeName=2, pNodeCode=2, limitUseTime=2, addReleaseUserApprovalYn=true)

    }
    @RAnno
    @WebLogAnno
    @GetMapping("/test3")
    public void test3() throws Exception {
        LinkedList<ActNodeDefMpgtModel> linkedList = new LinkedList<>();
        ActNodeDefMpgtModel actNodeDefMpgtModel1 = new ActNodeDefMpgtModel();
        actNodeDefMpgtModel1.setpNodeCode("1");
        actNodeDefMpgtModel1.setId(1);
        actNodeDefMpgtModel1.setActCode("1");
        actNodeDefMpgtModel1.setNodeCode("1");
        actNodeDefMpgtModel1.setNodeName("1");
        actNodeDefMpgtModel1.setLimitUseTime(1L);
        actNodeDefMpgtModel1.setAddReleaseUserApprovalYn(true);
        linkedList.add(actNodeDefMpgtModel1);
        ActNodeDefMpgtModel s = linkedList.get(0);
        log.debug("s:"+s); // s:ActNodeDefMpgtModel(id=1, actCode=1, nodeCode=1, nodeName=1, pNodeCode=1, limitUseTime=1, addReleaseUserApprovalYn=true)

        ActNodeDefMpgtModel actNodeDefMpgtModel2 = new ActNodeDefMpgtModel();
        actNodeDefMpgtModel2.setpNodeCode("2");
        actNodeDefMpgtModel2.setId(2);
        actNodeDefMpgtModel2.setActCode("2");
        actNodeDefMpgtModel2.setNodeCode("2");
        actNodeDefMpgtModel2.setNodeName("2");
        actNodeDefMpgtModel2.setLimitUseTime(2L);
        actNodeDefMpgtModel2.setAddReleaseUserApprovalYn(true);

        int i = linkedList.indexOf(actNodeDefMpgtModel1);
        linkedList.add(i,actNodeDefMpgtModel2);
        ActNodeDefMpgtModel s1 = linkedList.get(0);
        log.debug("s1:"+s1);  //s1:ActNodeDefMpgtModel(id=2, actCode=2, nodeCode=2, nodeName=2, pNodeCode=2, limitUseTime=2, addReleaseUserApprovalYn=true)

    }


}
